import { request } from '@/shared/axios';
import { getUserAuth } from '@/utils/login.ts';
import type { SyncInfoT } from '@/@types/type-notification.ts';

/**
 * 同步个人信息
 * @param {Object} params
 * @returns {Promise<ResponseT> }
 */
export function syncInfo(params: SyncInfoT) {
  const url = '/api-message/message_center/config/recipient/sync';
  const token = getUserAuth();
  return request
    .post(url, params, {
      headers: {
        token,
      },
    })
    .then((res) => {
      return res.data;
    });
}

/**
 * 获取所有消息的未读数量
 * @returns {Promise<ResponseT> }
 */
export function geAllCount() {
  const token = getUserAuth();
  const url = '/api-message/message_center/inner/count';
  return request
    .get(url, {
      headers: {
        token,
      },
    })
    .then((res) => {
      return res.data;
    });
}

